﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BigIntegerOperation
 
    //大数格式化形如10000000==format==>10_000_000
{
    class NumFormat
    {
    
        public static string Format(string num)
        {
            var sb = new StringBuilder();
            for (int i = Pretreatment.PreOne(num), index = 1; i >= 0; --i,++index)
            {
                sb.Insert(0, num[i]);//将num中的字符输出到StringBuilder内置数组中
                if(index % 3 == 0 && i != 0)
                   sb.Insert(0, '_');
            }
            if (sb[0]=='_')
                sb.Remove(0, 1);
            return sb.ToString();

        }

    }
}
